package com.google.zxing.client.android;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;

public class EncodeMainActivity extends Activity {
	private LinearLayout btn;
	private EditText eit_code;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.encode_view);
		// 获取界面元素
		getViews();
		// 按钮按下
		setListeners();
	}

	// 获取页面元素对象
	private void getViews() {
		btn = (LinearLayout) findViewById(R.id.btn_encode);
		eit_code = (EditText) findViewById(R.id.eit_origin);
	}

	// 按钮按下时监听
	private void setListeners() {
		btn.setOnClickListener(btnOnClick);
	}

	// 最快捷
	private LinearLayout.OnClickListener btnOnClick = new LinearLayout.OnClickListener() {
		@Override
		public void onClick(View v) {
			// 值
			String qd = eit_code.getText().toString();
			Toast.makeText(EncodeMainActivity.this, qd, Toast.LENGTH_LONG).show();
			
			// 
		    WebSearch webSearch = new WebSearch();
		    webSearch.setActivity(EncodeMainActivity.this);
		    webSearch.to(qd);
		}
	};
}